package com.nuoniu.sibanyun.controller.crm.call;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.crm.call.CrmCallAgent;
import com.nuoniu.sibanyun.entity.crm.call.CrmCallNumberPool;
import com.nuoniu.sibanyun.entity.crm.call.dto.CrmCallAgentSearchDto;
import com.nuoniu.sibanyun.entity.crm.call.dto.CrmCallNumberPoolSearchDto;
import com.nuoniu.sibanyun.service.crm.call.ICrmCallNumberPoolService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 客户系统-线路管理（资费） 前端控制器
 * </p>
 *
 * @author 白强
 * @since 2022-04-15
 */
@RestController
@RequestMapping("/crm/callNumberPool")
@Api(value="线路管理 ",tags={"线路管理"})
public class CrmCallNumberPoolController extends BaseController {

    @Autowired
    private ICrmCallNumberPoolService crmCallNumberPoolService;

    @PostMapping("pageCrmCallNumberPool")
    @ApiOperation(value = "分页查询 线路")
    @PreAuthorize("'system' == authentication.principal ")
    public HttpResult pageCrmCallNumberPool(@RequestBody CrmCallNumberPoolSearchDto crmCallNumberPoolSearchDto) {
        return HttpResult.ok(crmCallNumberPoolService.pageCrmCallNumberPool(crmCallNumberPoolSearchDto));
    }

    @PostMapping("saveCrmCallNumberPool")
    @ApiOperation(value = "保存 线路")
    @PreAuthorize("'system' == authentication.principal ")
    public HttpResult saveCrmCallNumberPool(@RequestBody CrmCallNumberPool crmCallNumberPool){
        crmCallNumberPoolService.saveCrmCallNumberPool(crmCallNumberPool);
        return HttpResult.ok();
    }

    @PostMapping("batchDelete")
    @ApiOperation(value = "批量 删除")
    @PreAuthorize("'system' == authentication.principal ")
    public HttpResult deleteFromId(@RequestBody List<Long> ids){
        crmCallNumberPoolService.batchDelete(ids);
        return HttpResult.ok();
    }

}
